package com.kgis.fm.common.component.legend{
    import com.kgis.map.Map;
    import com.kgis.map.control.basemaptool.AbstractBaseMapTool;
    import com.kgis.map.events.MapEvent;
    
    import mx.managers.PopUpManager;

    /**
     * 管线的图层控制数
     * */
    public class FmLegendControl extends AbstractBaseMapTool {
        private var legend:FmLegendDisplayControl;

        public function FmLegendControl(value:Map) {
            super(value);
        }

        override public function execute():void {
            legend = this.map.legendControl as FmLegendDisplayControl;
            legend.x = this.map.root.width - legend.width - 20;
            legend.y = 80;
            if (!legend.visible || !legend.isPopUp) {
                legend.visible = true;
                PopUpManager.addPopUp(legend, this._map, false);
                var mapEvent:MapEvent = new MapEvent(MapEvent.MOVE_END, map);
                mapEvent.oldZoom = 0;
                mapEvent.newZoom = map.zoom;
                legend.mapZoomLevelChangedHandler(mapEvent);
            }

        }

    }
}